import request from '@/utils/request'

export default {
    getPage: (params) => {
        return request({
            url: '/role/getPage',
            method: 'get',
            params
        })
    },
    add: (params) => {
        return request({
            url: '/role/add',
            method: 'post',
            data: params
        })
    },
    update: (params) => {
        return request({
            url: '/role/update',
            method: 'put',
            data: params
        })
    },
    remove: (id) => {
        return request({
            url: `/role/delete/${id}`,
            method: 'delete',
        })
    },
    getPermissionInfo: (roleId) => {
        return request({
            url: `/role/getPermissionInfo/${roleId}`,
            method: 'get'
        })
    },
    setRolePermission: (roleId, menuIds) => {
        return request({
            url: `/role/setRolePermission/${roleId}`,
            method: 'post',
            data: menuIds
        })
    }
}
